<template>
	<view class="notice">
		<view class="html" v-html="text">
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				text:''
			}
		},
		onLoad(o) {
			// console.log(o.id)
			this.$post('home/index', {
				page: 1,
				type: 1
			}).then(res => {
				// console.log(res)
				if (res.code == 0) {
					res.data.noticeList.forEach(v=>{
						if(o.id == v.id){
							this.text = v.content.replace(/\<img/gi, '<img class="img"')
						}
					})
					
				}
				if(res.code== -3){
					uni.showToast({
						title:'用户不存在请重新登录',
						icon:'none',
						mask:true
					})
					uni.clearStorage()
					setTimeout(()=>{
						uni.switchTab({
							url:'index'
						})
					},1200)
				}
				if(res.code== -4){
					uni.showToast({
						title:'用户已被禁用',
						icon:'none',
						mask:true
					})
					// uni.clearStorage()
					setTimeout(()=>{
						uni.switchTab({
							url:'index'
						})
					},1200)
				}
			})
		},
		onShareAppMessage(e) {
			return {
				title: '',
				path: '/pages/index/index'
			}
		},
		methods: {
	
		}
	}
</script>

<style lang="less">
	.notice{
		width: 100vw;
		.html{
			width: 100vw;
			
		}
		
	}
	.img{
		width: 100% !important;
	}
</style>
